/**
 * Author: ligj@mapbar.com
 * Create Time: 2018/01/10 17:09
 * Description:
 */

import ssoService from './services/sso.service';
export default {
    state: {
        userInfo: null,
        sliderIsCollapse: false,
        siteParam:{ // 权限的必填入参
            menuBar:'gwBoss',//xxx为权限系统里的授权标识
        },
        userDetails:{},  //跳路由保存参数，解决切换路由的时候无参数的问题
        // 避险项目demo 假数据存放
        
    },
    mutations: {
        setUserInfo(state, userInfo){
            state.userInfo = userInfo;
        },
        setUserDetails(state, params){
            state.userDetails = params;
      	},
        sliderIsCollapse(state, sliderIsCollapse){
            state.sliderIsCollapse = sliderIsCollapse;
        }
    },
    actions: {
        logout(context){
            return ssoService.logout().then(() => {
                context.commit('setUserInfo',null);
                return true;
            });
        },
        setUserDetails(context,params){
        	context.commit('setUserDetails',params);
        }
    },
    getters: {
    }
};
